Function PAD_SIGNAL

Package

convolution

Short description

Pad a signal

Usage

    y = PAD_SIGNAL(x, Npad, boundary, center)

Input

    x (numeric): The signal to be padded.
    Npad (numeric): The desired size of the padded output.
    boundary (string): The boundary condition of the signal, one of:
        'symm': Symmetric boundary condition with half-sample symmetry, for
             example [1 2 3 4]' -> [1 2 3 4 4 3 2 1]' for Npad = 8
        'per': Periodic boundary with half-sample symmetry, for example
             [1 2 3 4]' -> [1 2 3 4 1 2 3 4]' for Npad = 8
        'zero': Zero boundary, for example
             [1 2 3 4]' -> [1 2 3 4 0 0 0 0]' for Npad = 8
        (default 'symm')
    center (boolean): If true, the signal x is centered in the output y, 
        otherwise it is located in the (upper) left corner (default false).

Output

    y (numeric): The padded signal of size Npad

Description

    The input signal x is padded to give a signal of the size Npad using the 
    boundary conditions specified in boundary. This has the advantage of
    reducing boundary effects when computing convolutions by specifying 
    boundary to be 'symm' or 'zero', depending on the signal. It also allows
    for convolutions to be calculated on signals smaller than the filter was 
    originally defined for. Specifically, Npad does not need to be a multiple
    of size(x). Indeed, if x = [1 2 3 4]', we can have Npad = 11, which gives
    y = [1 2 3 4 4 3 2 4 3 2 1]'. There is a discontinuity since Npad is not
    a multiple of 4, but this discontinuity occurs as far from the original 
    signal, located in indices 1 through 4, as possible.
    The function takes both 1D and 2D inputs.

See also

List of all packages